<template>
  <div class="right-wrap">
    <div class="author-wrap">
      <div class="author-btns" v-show="!flag || !showRight">
        <span class="el-icon-back" @click="handleClick"></span>
      </div>
      <div class="author-con" v-show="flag && showRight">
        <span class="el-icon-close btn-close" @click="handleClose"></span>
        <div class="teacher-wrap">
          <RightTeacherInfo />
        </div>
      </div>
    </div>
    <div class="qa-wrap" v-show="type == 2 && showRight">
      <span class="el-icon-close btn-close" @click="handleClose"></span>
      <h2>提问题</h2>
      <RightQA />
      <h2>我的提问</h2>
      <RightQAList />
    </div>
    <div class="review-wrap" v-show="type == 3 && showRight">
      <span class="el-icon-close btn-close" @click="handleClose"></span>
      <h2>发表评论</h2>
      <RightReview />
      <el-divider></el-divider>
      <h2>我的评论</h2>
      <RightReviewList />
    </div>
    <div class="note-wrap" v-show="type == 4 && showRight">
      <span class="el-icon-close btn-close" @click="handleClose"></span>
      <h2>写笔记</h2>
      <RightNote />
      <el-divider></el-divider>
      <h2>我的笔记</h2>
      <RightNoteList />
    </div>
  </div>
</template>
<script>
export default {
  components: {
    RightTeacherInfo: () => import('./RightTeacherInfo.vue'),
    RightQA: () => import('./RightQA.vue'),
    RightQAList: () => import('./RightQAList.vue'),
    RightReview: () => import('./RightReview.vue'),
    RightReviewList: () => import('./RightReviewList.vue'),
    RightNote: () => import('./RightNote.vue'),
    RightNoteList: () => import('./RightNoteList.vue'),
  },
  data() {
    return {
      active: 1,
      flag: false,
    }
  },
  props: ['type', 'showRight'],
  mounted() {},
  methods: {
    handleClick() {
      this.flag = !this.flag
      this.$bus.$emit('showCourseRight', 1)
    },
    handleClose() {
      this.flag = false
      this.$bus.$emit('showCourseRight', 1, false)
    },
  },
}
</script>
<style scoped lang="scss">
.right-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  .author-wrap {
    width: 100%;
    height: 100%;
    .author-btns {
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      span {
        font-size: 22px;
        color: rgba(255, 255, 255, 0.4);
        cursor: pointer;
        &:hover {
          color: rgba(255, 255, 255, 0.8);
        }
      }
    }
    .author-con {
      position: relative;
      width: 100%;
      height: 100%;
      .btn-close {
        position: absolute;
        right: 10px;
        top: 10px;
        font-size: 24px;
        color: #eee;
        cursor: pointer;
        z-index: 2;
      }
      .teacher-wrap {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 1;
      }
    }
  }
  .review-wrap,
  .note-wrap,
  .qa-wrap {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    padding: 10px;
    background: #fff;
    z-index: 9;
    span {
      position: absolute;
      right: 10px;
      top: 10px;
      font-size: 24px;
      color: #666;
      cursor: pointer;
    }
    h2 {
      font-size: 16px;
      color: #545c63;
      line-height: 24px;
      font-weight: 700;
      margin-bottom: 16px;
    }
    overflow-y: scroll;
    &::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0.1);
      border-radius: 0;
    }
    &::-webkit-scrollbar {
      -webkit-appearance: none;
      width: 4px;
      height: 10x;
    }
    &::-webkit-scrollbar-thumb {
      cursor: pointer;
      border-radius: 5px;
      transition: color 0.2s ease;
      background-color: #999;
    }
  }
}
</style>